package com.tusuo.stds.rest;

import com.tusuo.stds.Constants.PATH;

import java.util.Map;

import okhttp3.RequestBody;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.PartMap;
import retrofit2.http.Query;
import rx.Observable;

/**
 * @author J.Huang
 * @version 1.0
 *
 */

public interface Api {
    @GET(PATH.API_GET_APP_INFO)
    Observable<AppInfo> getAppInfo(@Header("Cookie") String cookie,
                                   @Query("AppOS") String appOS,
                                   @Query("RegistrationId") String registrationId,
                                   @Query("Version") int version);

    @POST(PATH.API_GET_VERIFY_CODE)
    Observable<ApiResult> getCaptcha(@Header("Cookie") String cookie,
                                     @Query("MobilePhone") String mobilePhone);

    @POST(PATH.API_REGISTER)
    Observable<ApiResult> register(@Header("Cookie") String cookie,
                                   @Query("AppOS") String appOS,
                                   @Query("RegistrationId") String registrationId,
                                   @Query("UserName") String userName,
                                   @Query("Password") String password,
                                   @Query("VerifyCode") String verifyCode);

    @POST(PATH.API_LOGIN)
    Observable<ApiResult> login(@Header("Cookie") String cookie,
                                @Query("AppOS") String appOS,
                                @Query("RegistrationId") String registrationId,
                                @Query("UserName") String userName,
                                @Query("Password") String password);

    @POST(PATH.API_THIRD_LOGIN)
    Observable<ApiResult> thirdLogin(@Header("Cookie") String cookie,
                                     @Query("AppOS") String appOS,
                                     @Query("RegistrationId") String registrationId,
                                     @Query("OpenId") String openId,
                                     @Query("PlatFrom") String platFrom,
                                     @Query("AccessToken") String accessToken,
                                     @Query("NickName") String nickName,
                                     @Query("Avatar") String avatar);

    @POST(PATH.API_THIRD_BIND_EXIST)
    Observable<ApiResult> linkAccount(@Header("Cookie") String cookie,
                                      @Query("AppOS") String appOS,
                                      @Query("RegistrationId") String registrationId,
                                      @Query("UserName") String userName,
                                      @Query("Password") String password,
                                      @Query("OpenId") String openId,
                                      @Query("PlatFrom") String platFrom,
                                      @Query("AccessToken") String accessToken,
                                      @Query("NickName") String nickName,
                                      @Query("Avatar") String avatar);

    @POST(PATH.API_THIRD_BIND_NOT_EXIST)
    Observable<ApiResult> bindNew(@Header("Cookie") String cookie,
                                      @Query("AppOS") String appOS,
                                      @Query("RegistrationId") String registrationId,
                                      @Query("UserName") String userName,
                                      @Query("Password") String password,
                                      @Query("VerifyCode") String verifyCode,
                                      @Query("OpenId") String openId,
                                      @Query("PlatFrom") String platFrom,
                                      @Query("AccessToken") String accessToken,
                                      @Query("NickName") String nickName,
                                      @Query("Avatar") String avatar);

    @POST(PATH.API_THIRD_BIND_CURRENT)
    Observable<ApiResult> bindCurrent(@Header("Cookie") String cookie,
                                  @Query("OpenId") String openId,
                                  @Query("PlatFrom") String platFrom,
                                  @Query("AccessToken") String accessToken,
                                  @Query("NickName") String nickName,
                                  @Query("Avatar") String avatar);

    @POST(PATH.API_THIRD_UNBIND)
    Observable<ApiResult> unbindThird(@Header("Cookie") String cookie,
                                      @Query("PlatFrom") String platFrom);

    @POST(PATH.API_LOGOUT)
    Observable<ApiResult> logout(@Header("Cookie") String cookie,
                                @Query("AppOS") String appOS,
                                @Query("RegistrationId") String registrationId);

    @POST(PATH.API_SET_PASSWORD)
    Observable<ApiResult> setPassword(@Header("Cookie") String cookie,
                                      @Query("UserName") String userName,
                                      @Query("Password") String password,
                                      @Query("VerifyCode") String verifyCode);

    @POST(PATH.API_MODIFY_PASSWORD)
    Observable<ApiResult> modifyPassword(@Header("Cookie") String cookie,
                                      @Query("OldPassword") String oldPassword,
                                      @Query("NewPassword") String newPassword
                                      );

    @GET(PATH.API_GET_USER_INFO)
    Observable<UserInfo> getUserInfo(@Header("Cookie") String cookie);

    @POST(PATH.API_SET_MOBILE_NUM)
    Observable<ApiResult> setMobileNum(@Header("Cookie") String cookie,
                                     @Query("MobilePhone") String mobilePhone,
                                     @Query("Password") String password,
                                     @Query("VerifyCode") String verifyCode);

    @Multipart
    @POST(PATH.API_UPLOAD)
    Observable<UploadResponse> uploadImg(@Header("Cookie") String cookie,
                                         @Query("TypeKey") String typeKey,
                                         @Part("fileName") String description,
                                         @PartMap() Map<String, RequestBody> maps);

    @POST(PATH.API_SET_AVATAR)
    Observable<ApiResult> setAvatar(@Header("Cookie") String cookie,
                                  @Query("Url") String url);

    @POST(PATH.API_SET_NAME)
    Observable<ApiResult> setName(@Header("Cookie") String cookie,
                                      @Query("Name") String name);

    @POST(PATH.API_SET_GENDER)
    Observable<ApiResult> setGender(@Header("Cookie") String cookie,
                                  @Query("Sex") int sex);

    @GET(PATH.API_GET_AREA)
    Observable<AreaList> getArea(@Header("Cookie") String cookie);

    @GET(PATH.API_GET_SCHOOL)
    Observable<SchoolList> getSchool(@Header("Cookie") String cookie,
                                   @Query("AreaId") int areaId);

    @POST(PATH.API_SET_SCHOOL)
    Observable<ApiResult> setSchool(@Header("Cookie") String cookie,
                                    @Query("SchoolId") int schoolId,
                                    @Query("Name") String schoolName);
//                                    @Query("ProvinceId") int provinceId,
//                                    @Query("ProvinceName") String provinceName,
//                                    @Query("CityId") int cityId,
//                                    @Query("CityName") String cityName,
//                                    @Query("AreaId") int areaId,
//                                    @Query("AreaName") String areaName);

    @GET(PATH.API_GET_SCENE_LIST)
    Observable<SceneList> getSceneList(@Header("Cookie") String cookie);

    @GET(PATH.API_GET_SCENE_LIST)
    Observable<SceneList> getSceneList(@Header("Cookie") String cookie,
                                       @Query("type") int type,
                                       @Query("Keyword") String keyword
                                       );

    @GET(PATH.API_GET_SCENE_DETAIL)
    Observable<SceneDetail> getSceneDetail(@Header("Cookie") String cookie,
                                           @Query("SceneId") int sceneId);

    @GET(PATH.API_GET_MODULE_LIST)
    Observable<ModuleList> getModuleList(@Header("Cookie") String cookie,
                                         @Query("SceneId") int sceneId);

    @GET(PATH.API_GET_LEVEL_LIST)
    Observable<LevelList> getLevelList(@Header("Cookie") String cookie,
                                         @Query("ModuleId") int moduleId);

    @GET(PATH.API_GET_LEVEL_DETAIL)
    Observable<LevelDetail> getLevelDetail(@Header("Cookie") String cookie,
                                       @Query("LevelId") int levelId);

    @POST(PATH.API_SUBMIT_ANSWER)
    Observable<ApiResult> submitAnswer(@Header("Cookie") String cookie,
                                    @Query("LevelRecordId") int levelRecordId,
                                    @Query("RecordQuestionId") int recordQuestionId,
                                    @Query("ClearanceTime") long clearanceTime,
                                    @Query("AnswerContent") String answerContent);

    @GET(PATH.API_GET_LEVEL_RESULT)
    Observable<LevelResult> getLevelResult(@Header("Cookie") String cookie,
                                           @Query("LevelRecordId") int levelRecordId);

    @GET(PATH.API_GET_QUESTION_BANK_LIST)
    Observable<QuestionBankList> getBankList(@Header("Cookie") String cookie);

    @GET(PATH.API_GET_LEVEL_RECORD_LIST)
    Observable<LevelRecordList> getLevelRecordList(@Header("Cookie") String cookie,
                                                   @Query("PageNo") int pageNo,
                                                   @Query("PageSize") int pageSize);

    @GET(PATH.API_GET_LEVEL_RECORD_DETAIL)
    Observable<LevelRecordDetail> getLevelRecordDetail(@Header("Cookie") String cookie,
                                                       @Query("LevelRecordId") int levelRecordId);

    @GET(PATH.API_GET_SCENE_RANK)
    Observable<RankList> getSceneRank(@Header("Cookie") String cookie,
                                      @Query("SceneId") int sceneId);

    @GET(PATH.API_GET_MODULE_RANK)
    Observable<RankList> getModuleRank(@Header("Cookie") String cookie,
                                       @Query("ModuleId") int moduleId);

    @GET(PATH.API_GET_QUESTION_BANK_CONTENT)
    Observable<QuestionBankContent> getQuestionBankContent(@Header("Cookie") String cookie,
                                                           @Query("Ids") String ids);

    @GET(PATH.API_GET_QUESTION_BANK_GROUP)
    Observable<QuestionBankGroup> getQuestionBankGroup(@Header("Cookie") String cookie);

    @POST(PATH.API_REMOVE_WRONG_QUESTION)
    Observable<ApiResult> removeWrongQuestion(@Header("Cookie") String cookie,
                                              @Query("WrongQuestionId") int wrongQuestionId);

    @GET(PATH.API_GET_WRONG_QUESTION_SETTING)
    Observable<WrongQuestionSetting> getWrongQuestionSetting(@Header("Cookie") String cookie);

    @POST(PATH.API_SET_WRONG_QUESTION_SETTING)
    Observable<ApiResult> setWrongQuestionSetting(@Header("Cookie") String cookie,
                                              @Query("CorrectCount") int correctCount);

    @POST(PATH.API_SUBMIT_WRONG_QUESTION_ANSWER)
    Observable<WrongQuestionAnswerResult> submitWrongQuestionAnswer(@Header("Cookie") String cookie,
                                                  @Query("WrongQuestionId") int wrongQuestionId,
                                                  @Query("AnswerContent") String answerContent);

    @POST(PATH.API_SET_OPEN_SIMILARITY)
    Observable<ApiResult> setOpenSimilarity(@Header("Cookie") String cookie,
                                                                    @Query("IsOpen") boolean isOpen);

    @GET(PATH.API_GET_SIMILARITY_DETAIL)
    Observable<SimilarityDetail> getSimilarityDetail(@Header("Cookie") String cookie);

    @POST(PATH.API_SUBMIT_SIMILARITY_ANSWER)
    Observable<ApiResult> submitSimilarityAnswer(@Header("Cookie") String cookie,
                                       @Query("RecordQuestionId") int recordQuestionId,
                                       @Query("ClearanceTime") long clearanceTime,
                                       @Query("AnswerContent") String answerContent);

    @GET(PATH.API_GET_SIMILARITY_INFO)
    Observable<SimilarityInfo> getSimilarityInfo(@Header("Cookie") String cookie);

    @POST(PATH.API_GET_SCENE_UNLOCK_ATTACH_DATA)
    Observable<AttachDataResult> getSceneUnlockAttachData(@Header("Cookie") String cookie,
                                                          @Query("SceneId") int sceneId
                                                );

    @POST(PATH.API_GET_SCENE_REWARD_ATTACH_DATA)
    Observable<AttachDataResult> getSceneRewardAttachData(@Header("Cookie") String cookie,
                                                          @Query("SceneId") int sceneId,
                                                          @Query("Money") int money
    );

    @GET(PATH.API_GET_PAY_PARAM)
    Observable<PayParam> getPayParam(@Header("Cookie") String cookie,
                                     @Query("PayMethod") String payMethod,
                                     @Query("AttachData") String attachData
                                     );

    @GET(PATH.API_GET_PAY_PARAM)
    Observable<TenPayParam> getTenPayParam(@Header("Cookie") String cookie,
                                     @Query("PayMethod") String payMethod,
                                     @Query("AttachData") String attachData
    );
    @GET(PATH.API_GET_PAY_PARAM)
    Observable<QQPayParam> getQQPayParam(@Header("Cookie") String cookie,
                                     @Query("PayMethod") String payMethod,
                                     @Query("AttachData") String attachData
    );

    @GET(PATH.API_GET_VIP_LIST)
    Observable<VipList> getVipList(@Header("Cookie") String cookie);

    @POST(PATH.API_PAY_FOR_VIP)
    Observable<AttachDataResult> getVipAttachData(@Header("Cookie") String cookie,
                                                  @Query("Id") int id
                                                  );

    @GET(PATH.API_GET_COMPLETE)
    Observable<Complete> getComplete(@Header("Cookie") String cookie,
                                     @Query("DataId") int dataId,
                                     @Query("Type") int type
                                     );

    @GET(PATH.API_GET_COMPLETE_DETAIL)
    Observable<CompleteDetail> getCompleteDetail(@Header("Cookie") String cookie,
                                     @Query("DataId") int dataId,
                                     @Query("Type") int type,
                                           @Query("CompleteId") int completeId
    );

    @POST(PATH.API_COMMIT_SUGGEST)
    Observable<ApiResult> commitSuggest(@Header("Cookie") String cookie,
                                        @Query("Content") String content,
                                        @Query("ImageUrl") String imageUrl,
                                        @Query("Contact") String contact
                                        );

    @GET(PATH.API_SCENE_SET_HIDDEN)
    Observable<ApiResult> setSceneHidden(@Header("Cookie") String cookie,
                                         @Query("SceneId") int sceneId,
                                         @Query("IsHidden") boolean isHidden
                                         );

    @GET(PATH.API_SCENE_SET_SORT_INDEX)
    Observable<ApiResult> setSceneSortIndex(@Header("Cookie") String cookie,
                                            @Query("Ids") String ids
                                            );

    @GET(PATH.API_GET_CATALOG_LIST)
    Observable<CatalogList> getCatalogList(@Header("Cookie") String cookie);

    @GET(PATH.API_GET_ARTICLE_LIST)
    Observable<ArticleList> getArticleList(@Header("Cookie") String cookie,
                                           @Query("CatalogKey") String catalogKey
                                           );

    @GET(PATH.API_GET_COMPLETE_QUESTION)
    Observable<CompleteQuestion> getCompleteQuestion(@Header("Cookie") String cookie,
                                                   @Query("DataId") int dataId,
                                                   @Query("Type") int type,
                                                   @Query("CompleteId") int completeId
                                                   );

    @POST(PATH.API_SUBMIT_COMPLETE_QUESTION)
    Observable<ApiResult> submitCompleteQuestion(@Header("Cookie") String cookie,
                                                 @Query("RecordQuestionId") int id,
                                                 @Query("ClearanceTime") int time,
                                                 @Query("AnswerContent") String answer
                                                 );
    @GET(PATH.API_GET_COMPLETE_QUESTION_RESULT)
    Observable<CompleteResult> getCompleteResult(@Header("Cookie") String cookie,
                                                 @Query("RecordId") int id);


}
